package com.sskj.gocoinapp.presenter;

import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.Response;
import com.lzy.okrx2.adapter.FlowableBody;
import com.sskj.gocoin.m.HttpConfig;
import com.sskj.gocoin.m.bean.FabiDetailListBean;
import com.sskj.gocoin.m.bean.HaiPageBean;
import com.sskj.gocoin.m.bean.HttpData;
import com.sskj.gocoin.m.http.JsonCallBack;
import com.sskj.gocoin.m.http.JsonConverter;
import com.sskj.gocoin.mine.data.CommonBean;
import com.sskj.gocoinapp.bean.MiningLjRecord;
import com.sskj.gocoinapp.ui.activity.MiningRecordActivity;

import java.util.List;

import io.reactivex.Flowable;

public class MiningRecordPresenter extends BasePresenter<MiningRecordActivity> {

    public Flowable<List<MiningLjRecord.LJRecord>> getList(int page, int size, String type) {
        return OkGo.<HttpData<MiningLjRecord>>post(HttpConfig.BASE_URL + HttpConfig.MINING_RECORD)
                .params("p", page)
                .params("s", size)
                .params("type", "usdt_num".equals(type) ? 0 : 1)
                .converter(new JsonConverter<HttpData<MiningLjRecord>>() {
                })
                .adapt(new FlowableBody<>())
                .map(haiPageBeanHttpData -> haiPageBeanHttpData.getData().getData());
    }
}
